package com.tinama.jedis01.demo;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @author lgc
 * @createDate 2020/10/13 - 16:31
 */
public class CallableTest {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask futureTask = new FutureTask(new MyThread());
        new Thread(futureTask).start();
        new Thread(futureTask).start();
        Object o = futureTask.get();
        System.out.println("o = " + o);
    }
}
class MyThread implements Callable<Integer> {
    @Override
    public Integer call() throws Exception {
        System.out.println("执行了call1（）");
        return 1;
    }
}
